package com.haima.sage.bigdata.api.vo;

import com.haima.sage.bigdata.api.entity.ComputeTask;

import javax.persistence.Column;
import javax.persistence.Lob;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

public class ComputeTaskVO extends BaseVO {
    private String id;
    private String name;
    private String data;
    private String description;

    public Map<String, ?> getParams() {
        Map<String, Object> map = new HashMap<>();
        if (id != null) {
            map.put("beginDate", id);
        }
        if (name != null) {
            map.put("endDate", name);
        }
        if (data != null) {
            map.put("appId", data);
        }
        if (description != null) {
            map.put("appName", description);
        }
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public ComputeTask getComputeTask() {
        ComputeTask task = new ComputeTask();
        task.setId(id);
        task.setName(this.getName());
        task.setData(this.getData());
        task.setDescription(this.getDescription());
        task.setCreateDate(new Date());
        task.setUpdateDate(task.getCreateDate());
        return task;
    }
}
